
<template>
  <div class="tab-bar-item" v-on:click="itemClick">
    <div :class="{ active: isActive }">
      <slot name="icon"></slot>
      <slot name="text"></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "TabItem",
  props: {
    path: String,
  },
  data() {
    return {
      // isActive: false,
    };
  },
  computed: {
    isActive: {
      get(){
        return this.$route.path.indexOf(this.path) !== -1;
      },
      set() {

      }

    },
  },
  methods: {
    itemClick() {
      if (this.$route.path !== this.path) {
        this.$router.push(this.path);
      }
      this.isActive = !this.isActive;
    },
  },
  components: {},
};
</script>

<style scoped>
@import url("../../../assets/fa/css/all.min.css");
.tab-bar-item {
  flex: 1;
  text-align: center;
  height: 49px;
  /* line-height: 49px; */
}
.active {
  color: pink;
}
.tab-bar-item i {
  margin-top: 4px;
  margin-bottom: 2px;
  font-size: 24px;
  display: block;
}
</style>
